import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ProviderChannelVO, ProviderChannelForm, ProviderChannelQuery } from '@/api/provider/providerChannel/types';

/**
 * 查询供应商通道列表
 * @param query
 * @returns {*}
 */

export const listProviderChannel = (query?: ProviderChannelQuery): AxiosPromise<ProviderChannelVO[]> => {
  return request({
    url: '/provider/providerChannel/list',
    method: 'get',
    params: query
  });
};
/**
 * 查询所有供应商通道列表
 * @returns {*}
 */

export const listAllProviderChannel = (): AxiosPromise<ProviderChannelVO[]> => {
  return request({
    url: '/provider/providerChannel/listAll',
    method: 'get'
  });
};

/**
 * 查询供应商通道详细
 * @param id
 */
export const getProviderChannel = (id: string | number): AxiosPromise<ProviderChannelVO> => {
  return request({
    url: '/provider/providerChannel/' + id,
    method: 'get'
  });
};

/**
 * 新增供应商通道
 * @param data
 */
export const addProviderChannel = (data: ProviderChannelForm) => {
  return request({
    url: '/provider/providerChannel',
    method: 'post',
    data: data
  });
};

/**
 * 修改供应商通道
 * @param data
 */
export const updateProviderChannel = (data: ProviderChannelForm) => {
  return request({
    url: '/provider/providerChannel',
    method: 'put',
    data: data
  });
};

/**
 * 删除供应商通道
 * @param id
 */
export const delProviderChannel = (id: string | number | Array<string | number>) => {
  return request({
    url: '/provider/providerChannel/' + id,
    method: 'delete'
  });
};
